<?php
declare(strict_types=1);

use Phinx\Migration\AbstractMigration;

final class CreateTenantGroupTable extends AbstractMigration
{
    public function up()
    {
        $table = $this->table('tenant_group', ['id' => false, 'primary_key' => ['id'], 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '集团表']);
        $table->addColumn('id', 'integer', ['identity' => true, 'signed' => false, 'limit' => 11, 'comment' => '集团ID'])
            ->addColumn('name', 'string', ['signed' => false, 'default' => '', 'limit' => 60, 'comment' => '集团名'])
            ->addColumn('tenant_id', 'integer', ['signed' => false, 'default' => 0, 'limit' => 11, 'comment' => '所属公司ID'])
            ->addColumn('status', 'enum', ['values' => 'active, invalid', 'default' => 'active', 'comment' => '集团激活状态'])
            ->addColumn('created_by','integer', ['signed' => false, 'limit' => 11, 'default' => 0, 'comment' => '创建人'])
            ->addColumn('created', 'integer', ['signed' => false, 'default' => 0, 'limit' => 11, 'comment' => '创建时间'])
            ->addColumn('updated', 'integer', ['signed' => false, 'default' => 0, 'limit' => 11, 'comment' => '更改时间'])
            ->save();;
    }

    public function down()
    {
        $this->table('tenant_group')->drop()->save();
    }
}
